<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<body class="gray-bg">
    <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="integralJk-form">
					<div class="select-list">
						<ul>
							<li>
								<label>员工姓名： </label><input type="text" name="jkName"/>
							</li>
							<li>
								<label>部门名称： </label><select name="userDeptId" th:with="dept=${@dept.getDept()}" class="form-control m-b-none">
								<option value="">所有</option>
								<option th:each="dept : ${dept}" th:text="${dept.deptName}" th:value="${dept.deptId}"></option>
							</select>
							</li>
							<li>
								<label>职位名称： </label><select name="userPostId" th:with="post=${@post.getPost()} " class="form-control m-b-none">
								<option value="">所有</option>
								<option th:each="post : ${post}" th:text="${post.postName}" th:value="${post.postId}"></option>
							</select>
							</li>
							<li>
								<label>积分类型： </label><select name="integralTypeId" class="form-control m-b-none">
								<option value="">所有</option>
								<option value="">品德A分</option>
								<option value="">业绩B分</option>
								<option value="">行为C分</option>
							</select>
							</li>
							<li class="select-time">
								<label>积分奖扣时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<!--<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="integral:integralJk:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-success" onclick="$.operate.addAll()" shiro:hasPermission="integral:integralJk:add">
					<i class="fa fa-plus"></i> 批量添加
				</a>
			</div>-->

			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>	
		<!-- <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="integral:integralJk:add">
				<i class="fa fa-plus"></i> 添加
			</a>
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="integral:integralJk:add">
				<i class="fa fa-plus"></i> 批量添加
			</a>
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div> -->
    </div>
</div>
    <div th:include="include :: footer"></div>
	<script th:src="@{/ajax/libs/select/select2.js}"></script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('integral:integralJk:edit')}]];
        var removeFlag = [[${@permission.hasPermi('integral:integralJk:remove')}]];
        var prefix = ctx + "integral/integralJk";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
				createAllUrl: prefix + "/addAll",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "积分奖扣",
                columns: [{
		            checkbox: true
		        },
		        {
				    formatter: function (value, row, index) {
						return index+ 1;
                    }
				},
				{
					field : 'jkNum', 
					title : '奖扣编号' 
				},
				{
					field : 'jkTitle', 
					title : '奖扣标题',
					with : 204
				},
				{
					field : 'jkName', 
					title : '奖扣员工姓名' 
				},
				// {
				// 	field : 'jkPhone', 
				// 	title : '奖扣人员手机号'
				// },
				// {
				// 	field : 'deptName', 
				// 	title : '奖励人员所属部门' 
				// },
				// {
				// 	field : 'jkImg', 
				// 	title : '奖扣员工头像' 
				// },
				{
                    field : 'jkImg',
                    title : '奖扣员工头像',
                    formatter: function(value, row, index) {
                        if (value) {
                            return `<img src=${value} width="100" height="100"></img>`
                        } else {
                            return '没有上传头像'
                        }
                    }
                },
                {
                    field : 'typeId',
                    title : '积分类型',
					formatter: function (value) {
						switch (value) {
							case 1: return '品德A分';
							case 2: return '业绩B分';
							case 3: return '行为C分';
                        }
                    }
                },
				{
					field : 'jIntegral', 
					title : '奖励积分' 
				},
				{
					field : 'kIntegral', 
					title : '扣除积分' 
				},
				{
					field : 'jkTime', 
					title : '奖扣时间' 
				},
				// {
				// 	field : 'jkDescribe', 
				// 	title : '积分奖扣描述' 
				// },
				// {
				// 	field : 'status', 
				// 	title : '状态' 
				// },
				// {
				// 	field : 'remark', 
				// 	title : '描述' 
				// },
		        {
		            title: '操作',
		            align: 'center',
					width: 204,
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.jkId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
               //          actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.jkId + '\')"><i class="fa fa-remove"></i>删除</a>');
						actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="#" onclick="$.operate.editDetail(\'' + row.jkId + '\')"><i class="fa fa-search"></i>查看</a> ');
                        return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
				/*function addAll() {
                    var url = prefix + '/addAll/';
                    alert(url);
                    $.modal.open("批量添加" + $.table._option.modalName, url);
                }*/
    </script>
</body>
</html>